Hey guys, Imma teach you how to write a Lua binary module in C/C++ and make it work in CS2D using Dev-C++. Our module should read the files inside a directory and return them in a table.
1st step:
Download the Lua binaries for windows:
Luaforge
We will be downloading lua5.1.4 Win32 bin.zip
Place Lua5.1.dll in your Dev-C++/bin/ folder.
2nd step:
Download the lua source from Lua.org
Extract the following files and place them in your Dev-C++/Include/Lua folder:
Lauxlib.h
lua.h
luaconf.h
lualib.h
And in your Dev/C++/include folder make a file called Lua.hpp that should contain this:

3rd step:
Create a new windows Dll project

4th step:
Here you should write your code after all the stuff declared after the template in our dllmain.cpp file

5th step:
We make a function that should be registering our C++ functions

6th step:
We surround both our init and myluareadfolder functions with an extern "C" construction so that our compiller knows that these are C funcions , just like in Lua.hpp
Since Lua is completely written in C we will have to do this for C++ so that our compiler know that these are C functions.
Now you can compile.
Congratulations, you have successfully made a Lua binary extension without severely hurting/injuring/killling anybody
7th step:
Copy the lua5.1.dll file from your Dev-C++/bin directory and paste in a CS2D/libs/ folder, or paste it in C:/Windows/System32/
8th step:
Now that we have everything ready we will call our library through Lua.
And voila, we can call our C++ function using read_dir() and passing the folder you want to read
Notes:
I didn't explain too much because this would have been a very large post but you can ask something and I will (hopefully) answer ^^